home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / newsgroups / misc.19970626-19970929 / 000215_news@newsmaster….columbia.edu _Fri Aug 22 11:13:33 1997.msg < prev    next >
Internet Message Format  |  2020-01-01  |  3KB

  1. Return-Path: <news@newsmaster.cc.columbia.edu>
  2. Received: from newsmaster.cc.columbia.edu (newsmaster.cc.columbia.edu [128.59.35.30])
  3.     by watsun.cc.columbia.edu (8.8.5/8.8.5) with ESMTP id LAA15412
  4.     for <kermit.misc@watsun.cc.columbia.edu>; Fri, 22 Aug 1997 11:13:31 -0400 (EDT)
  5. Received: (from news@localhost)
  6.     by newsmaster.cc.columbia.edu (8.8.5/8.8.5) id LAA05584
  7.     for kermit.misc@watsun; Fri, 22 Aug 1997 11:13:24 -0400 (EDT)
  8. Path: news.columbia.edu!watsun.cc.columbia.edu!fdc
  9. From: fdc@watsun.cc.columbia.edu (Frank da Cruz)
  10. Newsgroups: comp.protocols.kermit.misc
  11. Subject: Re: echo command works differently between 3.14 and 3.15
  12. Date: 22 Aug 1997 15:13:21 GMT
  13. Organization: Columbia University
  14. Lines: 52
  15. Message-ID: <5tkaah$831$1@apakabar.cc.columbia.edu>
  16. References: <33f9b133.266082@news.calvacom.fr> <PYDViO7VXbx1@cc.usu.edu> <KM7xYazirna0@cc.usu.edu>
  17. NNTP-Posting-Host: watsun.cc.columbia.edu
  18. Xref: news.columbia.edu comp.protocols.kermit.misc:7530
  19.  
  20. In article <KM7xYazirna0@cc.usu.edu>, Joe Doupnik <jrd@cc.usu.edu> wrote:
  21. : Adding what I should have done in the above message: how to work
  22. : around this effect.  The solution is to use formal substitution variables,
  23. : \%letter items.
  24. : ...
  25. :     The second, variable, format works as desired: a green Yes is
  26. : displayed by both DISP and ECHO command lines. The reason it works is
  27. : because formal substitution variables reevaluate their results recursively,
  28. : thus the parser sees \%g, replaces it by \27[ etc and then reevalutes the
  29. : string from the \ byte again (and hence sees \27 as a \number to be
  30. : reduced to binary).
  31. :     Recall, \m(ge) is replaced by the macro ge's definition and that's
  32. : that. The definition is not rescanned for \number conversion.
  33. :
  34. There is method in this madness.  Several years of experience with the
  35. scripting language has shown that there is a need for two kinds of variables;
  36. one that is fully (i.e. recursively) evalated, and another that is evaluated
  37. only "one level deep" -- i.e. that is replaced by its literal definition.
  38.  
  39. Why?  Obviously we need a type of variable that is fully evaluated.  Example:
  40.  
  41.   define \%n OOFA
  42.   define \%t TXT
  43.   define \%f \%n.\%t
  44.   send \%f
  45.  
  46. The final command becomes "send OOFA.TXT".
  47.  
  48. But primarily because of DOS filenames, which use backslash as the directory
  49. separator (great idea!), we also need a type of variable that is evaluated
  50. only once.  To illustrate:
  51.  
  52.   define \%f c:\123\x00.txt
  53.   echo \%f
  54.  
  55. does not print "c:\123\x3b.txt".  Instead it prints "c:\{;.txt".  And so, of
  56. course, "send \%f" doesn't work either.
  57.  
  58. So for variables whose values are likely to contain literal backslashes,
  59. especially when they are followed by digits or certain other characters
  60. like "x", we use the other form:
  61.  
  62.   define filename c:\123\x00.txt
  63.   echo Sending \m(filename)...
  64.   send \m(filename)
  65.  
  66. The problems caused by backslashes in DOS filenames are not limited only
  67. to Kermit, as anybody who has had to write UNIX shell scripts to deal them
  68. can attest.  And of course, we get the worst of both worlds when we need to
  69. give a DOS filename to UNIX C-Kermit on the shell command line...
  70.  
  71. - Frank